package com.books.service.address.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.books.mapper.address.AddressMapper;
import com.books.model.entity.address.Receiving_address;
import com.books.service.address.IAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class AddressServiceImpl implements IAddressService {
    @Autowired(required = false)
    private AddressMapper addressMapper;
    @Autowired(required = false)
    private QueryWrapper<Receiving_address> queryWrapper;
    @Override
    public Receiving_address findById(int id) {
        return addressMapper.selectById (id);
    }

    @Override
    public List<Receiving_address> findAllByPid(int people_id) {
        return addressMapper.findAll (people_id);
    }

    @Override
    public void addAddress(Receiving_address address) { addressMapper.addAddress (address);
    }

    @Override
    public int findAddress(int people_id) {
        return addressMapper.findById (people_id);
    }

    @Override
    public void updateAddress(Receiving_address address) {
        addressMapper.updateById (address);
    }

    @Override
    public void delById(int id) {
        addressMapper.delById (id);
    }
}
